package com.Demo.flowcontrol.ifdemo;

import java.util.Scanner;

/*
    求3个数的较大值
 */
public class IfDemo1 {
    public static void main(String[] args) {
        //求2个数的较大值
        Scanner sc = new Scanner(System.in);
        //提示
        System.out.println("请您输入第一个数:");
        int num1 = sc.nextInt();
        //提示
        System.out.println("请您输入第二个数:");
        int num2 = sc.nextInt();
        //提示
        System.out.println("请您输入第三个数:");
        int num3 = sc.nextInt();

        //假设
        if (num1 > num2){
            //能进来一定是 num1 > num2
            if (num1 > num3){
                //num1 > num2 && num1 > num3
                System.out.println("最大值是num1:" + num1);
            }else{
                //num3 > num1 > num2
                System.out.println("最大值是num3:" + num3);
            }

        }else{
            //能进来一定是 num2 > num1
            if (num2 > num3){
                //num2 > num1 && num2 > num3
                System.out.println("最大值是num2:" + num2);
            }else{
                //num3 > num2 > num1
                System.out.println("最大值是num3:" + num3);
            }
        }
    }
}
